﻿using SqlSugar;
using System;

namespace IconYuan.Model.Entity.Orders
{
    /// <summary>
    /// 订单基础信息
    /// </summary>
    [SugarTable("t_order")]
    public class OrderBase
    {
        /// <summary>
        /// 自增订单ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int order_id { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        public string order_no { get; set; } = string.Empty;
        public int user_id { get; set; }
        /// <summary>
        /// 商品总金额
        /// </summary>
        public decimal goods_price { get; set; }
        /// <summary>
        /// 订单金额(含优惠折扣)
        /// </summary>
        public decimal order_price { get; set; }
        /// <summary>
        /// 实付金额(包含运费)
        /// </summary>
        public decimal pay_price { get; set; }
        /// <summary>
        /// 余额抵扣
        /// </summary>
        public decimal balance_money { get; set; }
        /// <summary>
        /// 优惠券ID
        /// </summary>
        public int coupon_id { get; set; }
        /// <summary>
        /// 优惠券抵扣金额
        /// </summary>
        public decimal coupon_money { get; set; }
        /// <summary>
        /// 等级抵扣金额
        /// </summary>
        public decimal grade_money { get; set; }
        /// <summary>
        /// 积分抵扣金额
        /// </summary>
        public decimal points_money { get; set; }
        /// <summary>
        /// 积分抵扣数量
        /// </summary>
        public int points_num { get; set; }
        /// <summary>
        /// 促销抵扣金额
        /// </summary>
        public decimal promotion_money { get; set; }
        /// <summary>
        /// 促销ID
        /// </summary>
        public int promotion_id { get; set; }
        /// <summary>
        /// 配送费
        /// </summary>
        public decimal express_price { get; set; }
        /// <summary>
        /// 订单状态(10 已取消, 20 待付款, 30 已付款,40 申请退款,41 申请退款退货 ,50 同意退款,60 拒绝退款, 70 已完成)
        /// </summary>
        public int order_status { get; set; } = 0;
        /// <summary>
        /// 物流状态(10 未发货 20 已发货,30 已收货)
        /// </summary>
        public int express_status { get; set; } = 10;
        /// <summary>
        /// 配送方式(10快递 ,20 同城配送, 30 自提)
        /// </summary>
        public int delivery_type { get; set; } = 10;
        /// <summary>
        /// 收货地址
        /// </summary>
        public string address { get; set; } = string.Empty;
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime create_time { get; set; }

        public int store_id { get; set; }
        /// <summary>
        /// 门店id
        /// </summary>
        public int shop_id { get; set; }
        /// <summary>
        /// 订单模型: 1 商品订单, 2 升级订单, 3 兑换订单 
        /// </summary>
        public int jump { get; set; } = 1;

    }
    /// <summary>
    /// 订单
    /// </summary>
    [SugarTable("t_order")]
    public class Order : OrderBase
    {       
      
        /// <summary>
        /// 付款时间
        /// </summary>
        public DateTime pay_time { get; set; }
        /// <summary>
        /// 支付方式(10余额支付 20微信支付)
        /// </summary>
        public int pay_type { get; set; }
        /// <summary>
        /// 买家留言
        /// </summary>
        public string buyer_remark { get; set; } = string.Empty;
        /// <summary>
        /// 订单是否已结算(0未结算 1已结算, 2 不需要结算, 3 结算失败)
        /// </summary>
        public int is_settled { get; set; } = 0;
        /// <summary>
        /// 赠送的积分数量
        /// </summary>
        public int points_gift { get; set; } = 0;
        /// <summary>
        /// 支付交易号
        /// </summary>
        public string transaction_id { get; set; } = string.Empty;
        /// <summary>
        /// 地区id
        /// </summary>
        public int region_id { get; set; }
        /// <summary>
        /// 联系人
        /// </summary>
        public string linkman { get; set; } = string.Empty;
        /// <summary>
        /// 联系方式
        /// </summary>
        public string phone { get; set; } = string.Empty;
        /// <summary>
        /// 配送时间(发货时间)
        /// </summary>
        public DateTime express_time { get; set; }        
        /// <summary>
        /// 物流公司ID
        /// </summary>
        public int express_id { get; set; }
        /// <summary>
        /// 物流单号
        /// </summary>
        public string express_no { get; set; } = string.Empty;
        /// <summary>
        /// 物流公司
        /// </summary>
        public string express_company { get; set; } = string.Empty;

    }
}
